package com.yanmaohu.nikita.utility;

import com.yanmaohu.nikita.data.expression.NameExpression;

import java.util.List;

/**
 * @author Bright Lee
 */
public final class IdentifierUtility {

    public static final String toString(List<NameExpression> list) {
        if (list == null || list.isEmpty()) {
            return null;
        }
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            NameExpression nameExp = list.get(i);
            buf.append(nameExp.getContent());
            if (i < list.size() - 1) {
                buf.append('.');
            }
        }
        return buf.toString();
    }

}
